#include <file_path.h>

char	*file_path(int argc, char *argv[])/**/
{
	char 	path1[] = "../docs/" ;
	char 	*path ;
	int		cmp = 1 ;
	
	/*S'assure que le programme a bien reçu un argument*/
	if (argc >= 2)
	{
		char *path2 = argv[1] ;
		path = calloc(22, sizeof(*path)) ;
		strcat(path, path1) ;		
		strcat(path, path2) ;
		
		/*Prévient d'un mauvais fichier en argument*/
		cmp *= strcmp(path2, "graphe11.txt") ;
		cmp *= strcmp(path2, "graphe12.txt") ;
		cmp *= strcmp(path2, "graphe13.txt") ;
		cmp *= strcmp(path2, "graphe14.txt") ;
		cmp *= strcmp(path2, "berlin52.txt") ;
		cmp *= strcmp(path2, "djibouti38.txt") ;
		cmp *= strcmp(path2, "kroA100.txt") ;
		cmp *= strcmp(path2, "Quatar194.txt") ;
		cmp *= strcmp(path2, "france.txt") ;
		cmp *= strcmp(path2, "monde.txt") ;
		if(cmp != 0)
		{
			printf("\nwrong input\n\nin order to run the program properly, please type as advised in the examples below :\n\n./TSP_solver_graphique graphe11.txt\n./TSP_solver_graphique graphe12.txt\n./TSP_solver_graphique graphe13.txt\n./TSP_solver_graphique graphe14.txt\n./TSP_solver_graphique berlin52.txt\n./TSP_solver_graphique djibouti38.txt\n./TSP_solver_graphique kroA100.txt\n./TSP_solver_graphique Quatar194.txt\n./TSP_solver_graphique france.txt\n./TSP_solver_graphique monde.txt\n\n") ;
			return (NULL) ;
		}
	}
	else
	{
		printf("\nwrong input\n\nin order to run the program properly, please type as advised in the examples below :\n\n./TSP_solver_graphique graphe11.txt\n./TSP_solver_graphique graphe12.txt\n./TSP_solver_graphique graphe13.txt\n./TSP_solver_graphique graphe14.txt\n./TSP_solver_graphique berlin52.txt\n./TSP_solver_graphique djibouti38.txt\n./TSP_solver_graphique kroA100.txt\n./TSP_solver_graphique Quatar194.txt\n./TSP_solver_graphique france.txt\n./TSP_solver_graphique monde.txt\n\n") ;
		return (NULL) ;
	}
	return (path) ;
}
